/**
 * Created by zzy on 2018/1/5.
 */
import React, {Component} from 'react';
import {
    Text,
    View,
    TouchableOpacity,
    StyleSheet,
    Dimensions
} from 'react-native';
import Modal from 'react-native-modalbox';
import Contant from '../../js/Contant'
import {observable, action, autorun, observe} from 'mobx'
import {observer} from 'mobx-react/native'
var {width,height} = Dimensions.get('window');
@observer
export default class UpdateMadal extends Component{
    @observable description='';
    render(){
        let cancel = this.props.cancel;
        let update=this.props.update;
        return <Modal
            position="center"
            ref={"modalUpdate"}
            backButtonClose={true}
            isOpen={false}
            coverScreen={false}
            style={{
                backgroundColor:'rgba(0,0,0,0)',
                alignItems:'center',
                justifyContent:'center'
            }}
        >
            <View style={{alignItems:'center',borderRadius:8,backgroundColor:'white',width:width-60}}>
                <View>
                    <Text style={{fontSize:15,padding:15,textAlign:'center'}}>新版本发布，赶快更新吧。</Text>
                    <Text style={{fontSize:15,padding:5,textAlign:'center'}}>{this.description}</Text>
                    <View style={{backgroundColor:Contant.SEPLINECOLOR,height:StyleSheet.hairlineWidth,width:width-60,overflow:'hidden'}}></View>

                    <View style={{flexDirection:'row',alignItems:'center',justifyContent:'center',padding:10}}>
                        <Text style={{fontSize:17,flex:1,textAlign:'center',color:'#ff5255'}} onPress={update}>更新</Text>
                        <Text style={{fontSize:17,flex:1,textAlign:'center',color:'#ff5255'}} onPress={
                            cancel
                        }
                        >取消</Text>
                    </View>
                </View>

            </View>
        </Modal>
    }
    openModal(description){
        this.description=description;
        this.refs.modalUpdate.open();
    }
    closeModal(){
        this.refs.modalUpdate.close();
    }
}